package net.zhengxinyun.performance.Util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

/**
 * Created by hyp1202 on 2019/1/18.
 */
@Component
public class UseRedis {

    private StringRedisTemplate stringRedisTemplate;

    @Autowired
    public UseRedis(StringRedisTemplate stringRedisTemplate) {
        this.stringRedisTemplate = stringRedisTemplate;
    }

    public String operateString(){
        stringRedisTemplate.opsForValue().set("key","value");
        String value = stringRedisTemplate.opsForValue().get("key");
        System.out.println(value);
        return value;
    }

}




